import { $fetchNet } from '../../utils/fetch.js'
Page({
  data: {
    on: "0",
    // 文旅资讯显示
    consultStatus: false,
    summaryStatus: true,
    focusList:[],
    focusListTop:[]
  },
  // 加载完成
  onLoad:function() {
    let _t = this;
    // 一、聚焦文旅列表
    $fetchNet('',{
      "r": "xcx/article/article-list",
      "page": 1
    },(res)=>{
      if(res.code == '200') {
        _t.setData({
          focusList: res.data
        })
      }
    })
   // 二、聚焦文旅置顶（3条）
    $fetchNet('', {
      "r": "xcx/article/article-top",
      "page": 1
    }, (res) => {
      if (res.code == '200') {
        _t.setData({
          focusListTop: res.data
        })
      }
    })
    // 专家服务列表
    $fetchNet('', {
      "r": "xcx/expert/index"
    }, (res) => {
      if (res.code == '200') {
      console.log(res)
      }
    })
  },
  switchTab: function (e) {
    let on = e.currentTarget.dataset.type;
    if(on == '0') {
      this.setData({
        on: on,
        consultStatus: false,
        summaryStatus: true
      })
    } 
    if(on == '1') {
      this.setData({
        on: on,
        summaryStatus: false,
        consultStatus: true
      })
    }
  }
})